package com.yunli.mall.controller;

import com.yunli.mall.common.schema.ResponseInvoke;
import com.yunli.mall.schema.entity.Seckill;
import com.yunli.mall.service.SeckillService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * @author yll
 * @date 2020/09/12
 */
@RestController
@RequestMapping("/seckill")
public class SeckillController {
    @Autowired
    private SeckillService seckillService;

    @GetMapping("list")
    public ResponseInvoke list(@RequestParam("time") Date time) {
        return ResponseInvoke.ok();
    }

    @GetMapping("detail/{seckillId}")
    public ResponseInvoke detail(@RequestParam("time") Date time) {
        return ResponseInvoke.ok();
    }

    @GetMapping("executor/{seckillId}/{phone}")
    public ResponseInvoke executor(@PathVariable("seckillId") String seckillId, @PathVariable("phone") String phone) {
        return ResponseInvoke.ok(seckillService.executor(seckillId, phone));
    }

    @GetMapping("result/{seckillId}/{phone}")
    public ResponseInvoke result(@PathVariable("seckillId") String seckillId, @PathVariable("phone") String phone) {
        return ResponseInvoke.ok(seckillService.result(seckillId, phone));
    }
}
